1. Field of The Invention
The present invention relates generally to a control unit and method for controlling a motor for use in a printer, and a storage medium storing a control program. More specifically, the invention is used for controlling the speed of a motor for driving a carriage of a serial printer.
2. Description of Related Art
In a typical serial printer such as an ink jet printer, a recording head scans on a printing paper to print. This recording head is fixed to a carriage to move with the carriage. This carriage is driven by a DC (Direct Current) motor. The system for driving the carriage is as follows.
First, a timing belt is stretched at a predetermined tension between a driving pulley, which is fixed to the rotating shaft of the DC motor, and a driven wheel which is a companion to the driving pulley. The carriage is mounted on the timing belt. Thus, the carriage is driven by the rotation of the DC motor so as to move main scanning directions.
When the carriage is moving at a constant speed, i.e., when the DC motor is rotating at a constant speed, print is carried out.
Conventionally, the speed control for causing the speed of the DC motor to be a constant speed is carried out by a PID control based on the deviation of a detected actual speed from a target speed.
However, as shown in FIG. 13, a typical DC motor has a stator 210 and a rotor 220. The stator 210 comprises a yoke 210a and a magnetic pole 210b. The rotor 220 comprises a protruding portion 220a which serves as a magnetic pole of an electromagnet, and a coil 220b which is wound onto the base portion of the protruding portion 220a. The rotor 220 is designed to sequentially switch the polarity of the electromagnet by the operation of a commutator 230 and a brush 240. Therefore, the DC motor has the fluctuation in torque. Assuming that the number of phases of the DC motor (the number of coils, i.e., the number of the base portions of the protruding portions 220a) is p, the fluctuation in torque occurs 2p times while the DC motor makes one rotation. Furthermore, the number of phases of the DC motor is 3 in FIG. 13.
Therefore, in the serial printer using the DC motor for driving the carriage, there is a problem in that the speed of the carriage (i.e., the speed of the DC motor) fluctuates due to the fluctuation in torque of the DC motor to cause the dispersion between printed dots, so that it is not possible to carry out a precise print.
It is therefore an object of the present invention to eliminate the aforementioned problems and to provide a control unit and method for controlling a motor for use in a printer, which can suppress the fluctuation in speed of the motor, and a storage medium having a control program recorded therein for controlling a motor for use in a printer.
In order to accomplish the aforementioned and other objects, according to one aspect of the present invention, there is provided a control unit for controlling a motor for use in a printer, the control unit comprising: a speed detecting part for detecting the speed of a motor for use in a printer in a predetermined period tv; an average speed calculating part for calculating an average speed using at least the current detected speed, which is detected by the speed detecting part, and a detected speed which has been detected n (xe2x89xa72), which corresponds to substantially half period of the fluctuation in speed of the motor, before the timing in detecting the current detected speed; and a speed control part for controlling the speed of the motor on the basis of a speed deviation of the average speed, which is the output of the average speed calculating part, from a target speed of the motor.
Furthermore, assuming that the period of the fluctuation in speed of the motor is Tv, the number n used for calculating the average speed preferably meets the following expression.
Tv/(2tv)xe2x88x922xe2x89xa6n less than Tv/(2tv)+2
The average speed calculating part preferably calculates an average speed of k+1 detected speeds from the current detected speed to a detected speed of k (n greater than kxe2x89xa70) before, and k+1 detected speeds from a detected speed of n before to a detected speed of k+1 before.
The speed control part preferably has a differentiating element which operates on the basis of the speed deviation of the average speed from the target speed.
The speed control part may have a proportional element which operates on the basis of the speed deviation of the average speed from the target speed.
The speed detecting part may comprise an encoder for generating an output pulse in accordance with the rotation of the motor, and a speed calculating part for calculating the speed of the motor in a period of the output pulse on the basis of the output pulse of the encoder.
The motor may be a carriage motor for use in an ink jet printer, and the encoder may generate the output pulse in accordance with the movement of a carriage driven by the carriage motor via a pulley, which is mounted of the rotating shaft of the carriage motor, and via a timing belt which is driven by the pulley.
Preferably, assuming that the distance between adjacent slits of a code plate of the encoder is xcex, that a pitch circle length of the pulley is L and that the number of phases of the motor is p, the n meets the following expression.
L/(4pxcex)xe2x89xa6n less than L/(4pxcex)+2
The speed control part may further comprise: a second speed calculating part for calculating the speed of the motor in a second predetermined period on the basis of the output pulse of the encoder; a second average speed calculating part for calculating the average speed using at least the current calculated speed, which is calculated by the second speed calculating part, and a calculated speed which has been m (mxe2x89xa72) before; and a second differentiating element which operates on the basis of a speed deviation of the output of the second average speed calculating part from the target speed.
The motor may be a DC motor.
According to another aspect of the present invention, there is provided a method for controlling a motor for use in a printer, the method comprising the steps of: detecting the speed of a motor for use in a printer in a predetermined period tv; calculating an average speed using at least the current detected speed and a detected speed which has been detected n (xe2x89xa72), which corresponds to substantially half period of the fluctuation in speed of the motor, before the timing in detecting the current detected speed; and controlling the speed of the motor on the basis of a speed deviation of the average speed from a target speed of the motor.
In this control method, assuming that the period of the fluctuation in speed of the motor is Tv, the number n used for calculating the average speed preferably meets the following expression.
Tv/(2tv)xe2x88x922xe2x89xa6n less than Tv/(2tv)+2
Preferably, the step of controlling the speed of the motor controls the speed of the motor on the basis of the sum of the speed deviation and the output of a differentiating element which operates on the basis of the speed deviation.
According to a further aspect of the present invention, there is provided a computer-readable storage medium storing control program code for controlling a motor for use in a printer, comprising: first program code means for detecting the speed of a motor for use in a printer in a predetermined period tv; second program code means for calculating an average speed using at least the current detected speed and a detected speed which has been detected n (xe2x89xa72), which corresponds to substantially half period of the fluctuation in speed of the motor, before the timing in detecting the current detected speed; and third program code means for controlling the speed of the motor on the basis of a speed deviation of the average speed from a target speed of the motor.